home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-07-28 | 19.6 KB | 931 lines | [TEXT/MPS ] |
- /*
- File: FileUtils.cp
-
- Contains: xxx put contents here xxx
-
- Written by: Tim Harnett
-
- Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <12> 4/5/95 HDA fix DoGet's check for folders. Now checks for ioDirMask
- <11> 2/21/95 TMH metrowerks change, add func prototypes
- <10> 1/11/95 TMH added Write(StringPtr pascalString)
- <8> 10/20/94 TMH added Exists()
- <7> 10/14/94 TMH some file id methods
- <6> 10/13/94 TMH added Delete()
- <5> 10/6/94 TMH SetFSSpec does not return an error
- <4> 10/3/94 TMH added SetType and SetCreator
- <3> 9/30/94 TMH added CFolderIterator
- <2> 9/27/94 TMH added CFSSpec, CFolder and CFile descend from CFSSpec
- <1> 9/20/94 TMH Abandon RoadsideRest embrace Mercury
- <4> 9/20/94 TMH added overloaded Write(char* str) method
- <3> 9/9/94 TMH more methods for CFile. Use of Failures
- <2> 6/14/94 TMH methods for opening closeing, writing
- 4/18/94 TMH xxx put comment here xxx
-
- To Do:
- */
-
- #ifndef __SCRIPT__
- #include "Script.h"
- #endif
-
- #ifndef __ERRORS__
- #include "Errors.h"
- #endif
-
- #ifndef __Debug__
- #include "Debug.h"
- #endif
-
- #ifndef __RESOURCES__
- #include "Resources.h"
- #endif
-
- #ifndef __STRING__
- #include "String.h"
- #endif
-
- #ifndef __STRINGS__
- #include "Strings.h"
- #endif
-
- #ifndef __PLSTRINGFUNCS__
- #include "PLStringFuncs.h"
- #endif
-
-
- #ifndef __THREADS__
- #include "Threads.h"
- #endif
-
- #ifndef __CommonResources__
- #include "CommonResources.h"
- #endif
-
- #ifndef __FileUtils__
- #include "FileUtils.h"
- #endif
-
-
- #ifndef __UFAILURE__
- #include "UFailure.h"
- #endif
-
- Boolean gFileAsync = true;
-
- //--------------------------------------
- // C F S S p e c
- //--------------------------------------
-
- CFSSpec::CFSSpec(short vRefNum,long parentdDirID,StringPtr name)
- {
-
- FSMakeFSSpec(vRefNum,parentdDirID,name,&fFSSpec);
- }
-
- CFSSpec::CFSSpec(short vRefNum,long parentDirID,char* name)
- {
-
- // See pg 2-35 Inside Macintosh Files
-
- if( name != 0 )
- c2pstr(name);
-
- if( name == 0 || name[0] == 0 ) {
-
- fFSSpec.vRefNum = vRefNum;
- fFSSpec.parID = parentDirID;
- fFSSpec.name[0] = 0;
-
- } else {
-
- FSMakeFSSpec(vRefNum,parentDirID,(StringPtr)name,&fFSSpec);
- }
-
- if( name != 0 )
- p2cstr((StringPtr)name);
- }
-
-
- CFSSpec::CFSSpec(HFileInfo* infoPB)
- {
- FSMakeFSSpec(infoPB->ioVRefNum,infoPB->ioFlParID,infoPB->ioNamePtr,&fFSSpec);
- }
-
- void CFSSpec::SetFSSpec(short vRefNum,long parentdDirID,StringPtr name)
- {
- FSMakeFSSpec(vRefNum,parentdDirID,name,&fFSSpec);
- }
-
-
- //-------------------------------------------------------------------------------
- OSErr CFSSpec::GetCatInfo(CInfoPBRec& cInfo)
- {
-
- // Caution: that ioNamePtr points into this CFile object.
-
- cInfo.hFileInfo.ioCompletion = NULL;
- cInfo.hFileInfo.ioNamePtr = this->NamePtr();;
- cInfo.hFileInfo.ioVRefNum = this->VRefNum();
- cInfo.hFileInfo.ioFDirIndex = 0;
- cInfo.hFileInfo.ioDirID = this->ParID();
- OSErr err = PBGetCatInfoSync(&cInfo); // •• async?
-
- return err;
-
- }
-
-
-
- //-------------------------------------------------------------------------------
- OSErr CFSSpec::SetCatInfo(CInfoPBRec& cInfo)
- {
-
- // Caution: that ioNamePtr points into this CFile object.
-
- cInfo.hFileInfo.ioCompletion = NULL;
- cInfo.hFileInfo.ioNamePtr = this->NamePtr();;
- cInfo.hFileInfo.ioVRefNum = this->VRefNum();
- cInfo.hFileInfo.ioDirID = this->ParID();
- OSErr err = PBSetCatInfoSync((CInfoPBRec*) &cInfo); // •• async?
-
- return err;
-
-
- }
-
-
- //--------------------------------------
- // C F i l e
- //--------------------------------------
-
-
- //-------------------------------------------------------------------------------
- CFile::CFile()
- {
- fRefNum = 0;
- }
-
- //-------------------------------------------------------------------------------
- CFile::CFile(short vRefNum,long parentDirID,StringPtr name) : CFSSpec(vRefNum,parentDirID,name)
- {
- fRefNum = 0;
- }
-
- //-------------------------------------------------------------------------------
- CFile::CFile(short vRefNum,long parentDirID,char* name) : CFSSpec(vRefNum,parentDirID,name)
- {
- fRefNum = 0;
- }
-
-
- //-------------------------------------------------------------------------------
- CFile::CFile(HFileInfo* infoPB) : CFSSpec(infoPB)
- {
- fRefNum = 0;
- }
-
-
- //-------------------------------------------------------------------------------
- OSErr CFile::Create(OSType fileCreator, OSType fileType)
- {
-
- return FSpCreate(&fFSSpec,fileCreator,fileType,smSystemScript);
- }
-
- //-------------------------------------------------------------------------------
- OSErr CFile::Open(char permission)
- {
- return FSpOpenDF(&fFSSpec,permission,&fRefNum);
- }
-
- //-------------------------------------------------------------------------------
- OSErr CFile::OpenResourceFork(char permission)
- {
- return FSpOpenRF(&fFSSpec,permission,&fRefNum);
- }
-
- //-------------------------------------------------------------------------------
- OSErr CFile::Close()
- {
- if( fRefNum != 0 )
- return FSClose(fRefNum);
-
- fRefNum = 0;
- return noErr;
- }
-
-
-
- //-------------------------------------------------------------------------------
- OSErr CFile::Delete()
- {
- OSErr osErr =this->Close();
- if( osErr != 0 )
- return osErr;
-
- return FSpDelete(&fFSSpec);
- }
-
-
- //-------------------------------------------------------------------------------
- OSErr CFile::Write(StringPtr thePString)
- {
- long dataLen = (long)thePString[0];
- return FSWrite(fRefNum,&dataLen,(Ptr)&thePString[1]);
- }
-
-
- //-------------------------------------------------------------------------------
- OSErr CFile::Write(void* data, long dataLen)
- {
- return FSWrite(fRefNum,&dataLen,(Ptr)data);
- }
-
-
- //-------------------------------------------------------------------------------
- OSErr CFile::Write(char* s) // for writing cstrings
- {
- long dataLen = strlen(s);
- return FSWrite(fRefNum,&dataLen,(Ptr)s);
- }
-
-
- //-------------------------------------------------------------------------------
- long CFile::GetPosition()
- {
- long position = 0;
- FailOSErr( GetFPos(fRefNum, &position) );
-
- return position;
- }
-
-
- //-------------------------------------------------------------------------------
- long CFile::GetSize()
- {
- long dataLength = 0;
- FailOSErr( GetEOF(fRefNum, &dataLength) );
- return dataLength;
- }
-
-
-
- //-------------------------------------------------------------------------------
- void CFile::SetPosition(long newPosition)
- {
- FailOSErr( SetFPos(fRefNum, fsFromStart, newPosition) );
- }
-
-
-
-
- //-------------------------------------------------------------------------------
- OSErr CFile::Read(void* data, long* dataLen)
- {
- return FSRead(fRefNum,dataLen,(Ptr)data);
- }
-
-
-
- //-------------------------------------------------------------------------------
- long CFile::ReadUntilChar(void* buf,long* dataLen,char tillChar)
- {
- char* p = (char*)buf;
-
- long amountRead = 0;
- while( amountRead < *dataLen ) {
-
-
- char c = this->ReadByte();
- if( c == tillChar)
- break;
-
- amountRead++;
- *p++ = c;
-
- }
-
- return amountRead;
-
- }
-
-
-
- //-------------------------------------------------------------------------------
- char CFile::ReadByte()
- {
- char c = 0;
- long readLen = 1;
- FailOSErr( FSRead(fRefNum,&readLen,(Ptr)&c) );
- return c;
- }
-
-
-
- //-------------------------------------------------------------------------------
- long CFile::ReadLine (char* lineBuf,long maxSize,char lineTerminator)
- {
-
- this->SetToStartOfLine(lineTerminator);
-
- lineBuf[0] = 0;
-
-
- long fileSize = this->GetSize();
- long curPosition = this->GetPosition();
- char c;
- long charCount = 0;
-
- maxSize--; // always allow room for the 0 terminator.
-
- while( curPosition < fileSize ) {
-
- c = this->ReadByte(); // avoid failures here!
- curPosition++;
-
- if( charCount > maxSize ) {
- lineBuf[charCount] = 0;
- Failure(kDataExceedsBufLen,0);
- }
-
- lineBuf[charCount] = c;
- charCount++;
-
- if( c == lineTerminator )
- break;
-
- }
-
-
- lineBuf[charCount] = 0;
-
- return charCount;
- }
-
-
-
- //-------------------------------------------------------------------------------
- void CFile::SetToStartOfLine(char lineTerminator)
- {
-
- // Move the file marker to the beginning of the
- // next line in the file.
-
-
- FailInfo fi;
- Try(fi) {
-
- long curPosition = this->GetPosition();
- long size = this->GetSize();
- char c;
-
- if( (curPosition < size) && (curPosition != 0) ) {
- this->SetPosition(curPosition-1);
- do {
- c = this->ReadByte();
- } while( c != lineTerminator );
- }
-
- fi.Success();
- }
-
- }
-
-
- //-------------------------------------------------------------------------------
- OSErr CFile::SetType(OSType fileType)
- {
-
- CInfoPBRec fileInfoPB;
- memset(&fileInfoPB,0,sizeof(CInfoPBRec));
-
- OSErr osErr = this->GetCatInfo(fileInfoPB);
- if( osErr != 0 )
- return osErr;
-
- fileInfoPB.hFileInfo.ioFlFndrInfo.fdType = fileType;
-
- osErr = this->SetCatInfo(fileInfoPB);
- if( osErr != 0 )
- return osErr;
-
-
- return osErr;
-
- }
-
-
- //-------------------------------------------------------------------------------
- OSErr CFile::SetCreator(OSType fileCreator)
- {
-
- CInfoPBRec fileInfoPB;
- memset(&fileInfoPB,0,sizeof(CInfoPBRec));
-
- OSErr osErr = this->GetCatInfo(fileInfoPB);
- if( osErr != 0 )
- return osErr;
-
- fileInfoPB.hFileInfo.ioFlFndrInfo.fdCreator = fileCreator;
-
- osErr = this->SetCatInfo(fileInfoPB);
- if( osErr != 0 )
- return osErr;
-
-
- return osErr;
-
- }
-
-
- //-------------------------------------------------------------------------------
- OSErr CFile::SetCreatorAndType(OSType fileCreator,OSType fileType)
- {
-
- CInfoPBRec fileInfoPB;
- memset(&fileInfoPB,0,sizeof(CInfoPBRec));
-
- OSErr osErr = this->GetCatInfo(fileInfoPB);
- if( osErr != 0 )
- return osErr;
-
- fileInfoPB.hFileInfo.ioFlFndrInfo.fdType = fileType;
- fileInfoPB.hFileInfo.ioFlFndrInfo.fdCreator = fileCreator;
-
- osErr = this->SetCatInfo(fileInfoPB);
- if( osErr != 0 )
- return osErr;
-
-
- return osErr;
-
- }
-
-
-
- //-------------------------------------------------------------------------------
- long CFile::GetCreationDate()
- {
- HParamBlockRec pb;
-
- if (this->GetFileInfo(pb) == noErr)
- return pb.fileParam.ioFlCrDat;
- else
- return 0;
- }
-
-
- //-------------------------------------------------------------------------------
- long CFile::GetModificationDate()
- {
- HParamBlockRec pb;
-
- if (this->GetFileInfo(pb) == noErr)
- return pb.fileParam.ioFlMdDat;
- else
- return 0;
- }
-
-
-
-
- //------------------------------------------------------------------------------------------------------------------------
- OSErr CFile::GetPhysicalSize(long& dataSize, long& rsrcSize)
- {
- HParamBlockRec pb;
- OSErr theErr;
-
- if ((theErr = this->GetFileInfo(pb)) == noErr) {
- dataSize = pb.fileParam.ioFlPyLen;
- rsrcSize = pb.fileParam.ioFlRPyLen;
- }
- return theErr;
- }
-
-
-
- //------------------------------------------------------------------------------------------------------------------------
- OSErr CFile::GetFileInfo(HParamBlockRec& pb)
- {
- CStr63 itsName;
-
- itsName = fFSSpec.name;
- pb.fileParam.ioNamePtr = (StringPtr) itsName;
- pb.fileParam.ioVRefNum = this->VRefNum();
- pb.fileParam.ioDirID = this->ParID();
- pb.fileParam.ioFVersNum = 0;
- pb.fileParam.ioFDirIndex = 0;
- OSErr err = PBHGetFInfoSync(&pb);
- pb.fileParam.ioNamePtr = NULL;
- return err;
- }
-
-
-
- //------------------------------------------------------------------------
- OSErr CFile::GetFileID(long* fileID )
- {
- *fileID = 0;
-
- FIDParam fidPB;
- memset(&fidPB,0,sizeof(FIDParam));
-
- fidPB.ioNamePtr = this->NamePtr();
- fidPB.ioVRefNum = this->VRefNum();
- fidPB.ioSrcDirID = this->ParID();
-
- OSErr osErr = PBCreateFileIDRef( (HParmBlkPtr)&fidPB, false );
-
- if( (osErr == 0) || (osErr == fidExists)) {
- *fileID = fidPB.ioFileID;
- osErr = 0;
- }
-
-
- return osErr;
- }
-
-
-
-
- //------------------------------------------------------------------------
- Boolean CFile::Exists()
- {
- HParamBlockRec pb;
- return this->GetFileInfo(pb) == 0;
- }
-
- //--------------------------------------
- // C F o l d e r
- //--------------------------------------
-
-
- CFolder::CFolder(short vRefNum,long parentDirID,StringPtr name) : CFSSpec(vRefNum,parentDirID,name)
- {
- fDirID = 0;
- fFolderType = 0;
- }
-
- CFolder::CFolder(short vRefNum,long parentDirID,char* name) : CFSSpec(vRefNum,parentDirID,name)
- {
- fDirID = 0;
- fFolderType = 0;
- }
-
- OSErr CFolder::CreateFolder()
- {
- return FSpDirCreate(&fFSSpec,smSystemScript,&fDirID);
- }
-
-
- //-------------------------------------------------------------------------
- CFolder::CFolder(OSType folderType)
- {
- fDirID = 0;
- fFolderType = folderType;
-
- long parentDirID = 0;
- short vRefNum = 0;
-
- if( folderType == 'root' )
- parentDirID = 2;
-
- if( parentDirID != 2 )
- FindFolder(0,folderType,kCreateFolder,&vRefNum,&parentDirID);
-
-
- this->SetFSSpec(vRefNum,parentDirID,(StringPtr)0);
-
- // Set the name and directory ID.
-
- DirInfo dirInfoPB;
- OSErr osErr = this->GetDirInfo(dirInfoPB);
-
- if(osErr == 0 )
- fDirID = dirInfoPB.ioDrDirID;
-
- }
-
-
-
- //-------------------------------------------------------------------------
- OSErr CFolder::GetDirInfo(DirInfo& dirInfoPB)
- {
- memset(&dirInfoPB,0,sizeof(DirInfo));
- return this->GetCatInfo((CInfoPBRec&)dirInfoPB);
- }
-
- //----------------------------------
- // C F o l d e r I t e r a t o r
- //-----------------------------------
-
-
-
- CFolderIterator::CFolderIterator(CFolder& folder,CFolderIterator::ItemFilter itemFilter)
- {
- fItemFilter = itemFilter;
- fIndex = 0;
- fCatInfo = (HFileInfo*)&fCatInfoPB;
-
- fVRefNum = folder.VRefNum();
- fDirID = folder.DirID();
-
- }
-
- //-------------------------------------------------------------------------------------
- HFileInfo* CFolderIterator::FirstFile()
- {
- fIndex = 1;
-
- this->DoGet();
-
- if( fCatInfo->ioResult != 0 )
- return (HFileInfo*)0;
-
- return fCatInfo;
- }
-
-
- //-------------------------------------------------------------------------------------
- HFileInfo* CFolderIterator::NextFile()
- {
- fIndex++;
-
- if( this->More() )
- this->DoGet();
-
- if( fCatInfo->ioResult != 0 )
- return (HFileInfo*)0;
-
- return fCatInfo;
- }
-
-
-
- //-------------------------------------------------------------------------------------
- void CFolderIterator::DoGet()
- {
-
-
- for(;;) {
-
- // Experience has taught that it is safest
- // to completely reset the PB every time.
-
- memset(&fCatInfoPB,0,sizeof(CInfoPBRec));
-
- fCatInfo->ioFDirIndex = fIndex;
- fCatInfo->ioVRefNum = fVRefNum;
- fCatInfo->ioDirID = fDirID;
- fNameBuf[0] = 0;
- fCatInfo->ioNamePtr = (StringPtr)fNameBuf;
-
- PBGetCatInfo((CInfoPBPtr)fCatInfo,gFileAsync);
-
- do {
- YieldToAnyThread();
- } while( gFileAsync && (fCatInfo->ioResult > 0) );
-
- if( fCatInfo->ioResult != 0 )
- break;
-
-
- if ((fCatInfo->ioFlAttrib & ioDirMask) == ioDirMask) {
- if( fItemFilter == kFoldersOnly || fItemFilter == kFilesAndFolders)
- break; // its a folder
- } else {
- if( fItemFilter == kFilesOnly || fItemFilter == kFilesAndFolders)
- break; // its a file
- }
-
- fIndex++;
-
- }
-
-
- }
-
-
-
-
-
- //-----------------------
- // Procedural Stuff
- //-----------------------
-
-
- //------------------------------------------------------------------------------------------------------
- #pragma segment Templates
- OSErr SearchFolder(short vRefNum, long dirID, Boolean (*DoEachFile)(HFileInfo* filePB,void* refCon), void* refCon )
- {
- CInfoPBRec catPB;
- HFileInfo *filePB;
- Str255 nameBuf;
- OSErr err;
- int index;
-
- index = 1;
- filePB = (HFileInfo*)&catPB;
- do {
- memset(filePB,0,sizeof(CInfoPBRec));
- filePB->ioNamePtr = (StringPtr)&nameBuf;
- filePB->ioFDirIndex = index;
- filePB->ioVRefNum = vRefNum;
- filePB->ioDirID = dirID;
-
- err = PBGetCatInfo((CInfoPBPtr)filePB,0);
-
- if( err == noErr )
- if( DoEachFile((HFileInfo*)&catPB,refCon) )
- break;
-
- index++;
- } while( err == 0 );
-
-
- return err;
- }
-
-
- //------------------------------------------------------------------------------------------------------
- Boolean FindAnyFile(HFileInfo* filePB,void* refCon)
- {
- Boolean haltSearch = false;
- if( (filePB->ioFlAttrib & ioDirMask) == 0 ) { // skip folders
-
- CFile* file = (CFile*)refCon;
- FSMakeFSSpec(filePB->ioVRefNum,filePB->ioFlParID,filePB->ioNamePtr,&file->fFSSpec);
- haltSearch = true;
- }
-
- return haltSearch;
-
- }
-
-
-
- //------------------------------------------------------------------------------------------------------
- Boolean __FindFolder(HFileInfo* filePB,void* refCon)
- {
- Boolean haltSearch = false;
-
- if( (filePB->ioFlAttrib & ioDirMask) != 0 ) { // check only folders
-
- CFolder* folder = (CFolder*) refCon;
-
- if( PLstrcmp(folder->fFSSpec.name,filePB->ioNamePtr) == 0 ) {
- FSMakeFSSpec(filePB->ioVRefNum,filePB->ioFlParID,filePB->ioNamePtr,&folder->fFSSpec);
- folder->fDirID = filePB->ioDirID;
- haltSearch = true;
- }
- }
-
- return haltSearch;
-
- }
-
-
- //------------------------------------------------------------------------------------------------------
- OSErr FindFolder(CFolder* folder)
- {
- return SearchFolder(folder->fFSSpec.vRefNum, folder->fFSSpec.parID, __FindFolder,folder);
- }
-
-
- //------------------------------------------------------------------------------------------------------------------------
- Boolean __FindFileByName(HFileInfo* filePB,void* refCon); // the compile insist on a prototype
- Boolean __FindFileByName(HFileInfo* filePB,void* refCon)
- {
- CFile* file = (CFile*) refCon;
- Boolean haltSearch = false;
-
- if( PLstrcmp(file->fFSSpec.name,filePB->ioNamePtr) == 0 ) {
- FSMakeFSSpec(filePB->ioVRefNum,filePB->ioFlParID,filePB->ioNamePtr,&file->fFSSpec);
- haltSearch = true;
- }
-
- return haltSearch;
- }
-
-
-
- //------------------------------------------------------------------------------------------------------------------------
- Boolean FindFileByName(short vRefNum, long dirID, CFile* fileToFind)
- {
- fileToFind->fFSSpec.vRefNum = 0;
- return SearchFolder(vRefNum,dirID,__FindFileByName, fileToFind);
- }
-
-
- //-------------------------------------------------------------------------------------
- int ParseHFSPath(char* pathName,char** folderList)
- {
-
- // Get a list of folder names from a path name
-
- int folderLevels = 0;
- char* token = strtok(pathName,":");
-
- while( (token!=0) && (folderLevels<kMaxPathLevels) ) {
- folderList[folderLevels++] = token;
- token = strtok(NULL,":");
- }
-
- // convert them to pascal strings.
-
- for(int i=0;i<folderLevels;i++)
- c2pstr(folderList[i]);
-
- return folderLevels;
- }
-
-
-
- //-------------------------------------------------------------------------------------
- OSErr FocHFSHeirarchy(OSType folderParentType,char* path,CFolder& lastChild)
- {
- // Get the dirID for parent
-
-
- short rootVRefNum = 0;
- long parentDirID = 0;
-
- if( folderParentType == 'root' )
- parentDirID = 2;
-
- if( parentDirID != 2 )
- FindFolder(0,folderParentType,kCreateFolder,&rootVRefNum,&parentDirID);
-
-
- // Create list of folder names.
-
-
- char* folderNames[kMaxPathLevels];
- int folderLevels = ParseHFSPath(path,folderNames);
- ASSERT(folderLevels!=0);
-
-
-
- for(int i=0;i<folderLevels;i++) {
-
-
- CFolder aFolder(0,parentDirID,(StringPtr)folderNames[i]);
- OSErr osErr = FindFolder(&aFolder);
-
- if( osErr != 0 )
- aFolder.CreateFolder();
-
-
- // Cache it. -- it may be the last child
-
-
- lastChild = aFolder; // bitwize copy
- parentDirID = lastChild.fDirID; // the next folder goes is a child of the previous
- }
-
-
- return noErr; // just an innocent assumption!?!?!
-
-
- }
-
-
- //-------------------------------------------------------------------------------------
- OSErr FocHFSHeirarchyFromResource(short resId,CFolder& lastChild)
- {
-
- FolderSpecResource** folderResource = (FolderSpecResource**) ::GetResource('fldr',resId);
- FailResError();
-
- char path[kMaxPathnameLen];
- BlockMove((*folderResource)->folderPath,path,kMaxPathnameLen); // copy this 'cause it gets modified by strtok below
-
- return FocHFSHeirarchy((*folderResource)->folderParentType,path,lastChild);
- }
-
-
-
- //-----------------------------------------------------------------------------------
- OSErr ExchangeFileIDs(CFile& srcFile,CFile& destFile)
- {
- #ifdef JUNK
- FIDParam fidPB;
- memset(&fidPB,0,sizeof(FIDParam));
-
- fidPB.ioNamePtr = srcFile.NamePtr();
- fidPB.ioVRefNum = srcFile.VRefNum();
- fidPB.ioSrcDirID = srcFile.ParID();
-
- fidPB.ioDestNamePtr = destFile.NamePtr();
- fidPB.ioDestDirID = destFile.ParID();
-
- return PBExchangeFiles( (HParmBlkPtr)&fidPB, false );
- #endif
- return FSpExchangeFiles(&srcFile.fFSSpec,&destFile.fFSSpec);
- }
-
-